FROM python:3.7-alpine as base

FROM base as build
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt -i https://pypi.douban.com/simple/
# fix django 1.11 and python3 incompatibility problem
RUN sed -i '151 s/,$//' /usr/local/lib/python3.7/site-packages/django/contrib/admin/widgets.py

FROM base as final
COPY --from=build /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages
WORKDIR /app
ENV PYTHONUNBUFFERED=1
COPY . .
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "--insecure", "0.0.0.0:8000"]




#FROM python:3.7
#FROM python:3.7-alpine
#ENV PYTHONUNBUFFERED=1
#WORKDIR /myapps
#COPY requirements.txt ./
#RUN pip install -r requirements.txt -i https://pypi.douban.com/simple/
## fix django 1.11 and python3 incompatibility problem
#RUN sed -i '151 s/,$//' /usr/local/lib/python3.7/site-packages/django/contrib/admin/widgets.py
#COPY . .
#EXPOSE 8000
#CMD ["python", "manage.py", "runserver", "--insecure", "0.0.0.0:8000"]